﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.basis
{
    public partial class styleedit : System.Web.UI.Page
    {
        Maticsoft.BLL.style bll = new Maticsoft.BLL.style();
        Maticsoft.BLL.Parts blls = new Maticsoft.BLL.Parts();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidid.Value = Request.QueryString["id"];
                this.typelist.DataSource = blls.GetList("");
                this.typelist.DataTextField = "name";
                this.typelist.DataValueField = "code";
                this.typelist.DataBind();
                this.typelist.Items.Insert(0, new ListItem("--请选择部位信息--", ""));
                if (!string.IsNullOrEmpty(Request["code"]))
                    this.typelist.SelectedValue = Request["code"];
                if (!string.IsNullOrEmpty(hidid.Value))
                {
                    Maticsoft.Model.style md = bll.GetModel(Convert.ToInt32(hidid.Value));
                    ddtype.SelectedValue = md.dtype.ToString();
                    price.Value = md.price.ToString();
                    ckorder.Checked = md.ispricedingdan.Value == 1 ? true : false;
                    hidurl.Value = md.bantuurl;
                    hidupurls.Value = md.xiaoguourl;
                    hidcInvCode.Value = md.cInvCode;
                    hidcInvName.Value = md.cInvName;
                    code.Value = md.cInvCode + md.cInvName;
                    typelist.SelectedValue = md.partscode;
                    stylecode.Value = md.code;
                }
                else
                {
                    stylecode.Value = "KS" + DateTime.Now.ToString("yyMMddHHmmss");
                }
            }
        }
    }
}